<link href="<?php echo base_url();?>style/style.css" rel="stylesheet" type="text/css" />
<script src="<?php echo base_url();?>script/jquery.tablesorter.js" type="text/javascript"></script>
<script src="<?php echo base_url();?>script/jquery.uitablefilter.js" type="text/javascript"></script>
<script>
    $(document).ready(function() {
        $("#representativesTable").tablesorter();

      var theTable = $('table.tablesorter')

     /* theTable.find("tbody > tr").find("td:eq(1)").mousedown(function(){
        $(this).prev().find(":checkbox").click()
      });
*/
      $("#filter").keyup(function() {
        $.uiTableFilter( theTable, this.value );
      })
/*
      $('#filter-form').submit(function(){
        theTable.find("tbody > tr:visible > td:eq(1)").mousedown();
        return false;
      }).focus(); //Give focus to input field
*/
   
       //Potvrda za brisenje
        $('.confirmDelete').click(function(){
            var answer = confirm("Are you sure?");
            if(answer){
                window.location = $(this).attr("title");
            }else{
                return;
            }
        });

       //Upload na sliki


    })
</script>
<div class="middleFront">
    <div class="infoText infoTitle">
        Листа на претставници
    </div>
    <div class="questionsHolder">
        <div class="searchboxHolder">
            <table>
                <tr>
                    <td>Барај:</td>
                    <td><input type="text" name="filter" id="filter" class="stiliziran"></td>
                    <td>&nbsp;</td>
                    <td><a href="<?php echo base_url().'mk/admin/municipalities/addmunicipality';?>">Додади Општина/Град</a></td>
                    </tr>
            </table>
        </div>
        <?php //debug($representatives) ?>
        <table id="representativesTable" class="tablesorter">
            <thead>
                <tr>
                    <th width="30%"><?php echo lang('mun_const')?></th>
                    <th width="20%"><?php echo lang('logo')?></th>
                    <th width="10%"><?php echo lang('translate')?></th>
                    <th width="10%"><?php echo lang('edit')?></th>
                    <th width="10%"><?php echo lang('delete')?></th>
                </tr>
            </thead>
            <tbody>
                <?php 
                foreach ($allMunicipalities as $mun) {
                    echo '<tr>';
                    echo '<td width="40%">'.$mun->municipality_name.'</td>';
                    echo '<td>'.$mun->municipality_logo.'</td>';
                        echo '<td>';
                        echo "translation";
                        echo '</td>';
                    if (isset($admin)) {
                        echo '<td>';
                        echo '<a href="'.base_url().'mk/admin/municipalities/editmunicipality/'.$mun->pkMunicipalityID.'">';
                            echo '<img src="'.base_url().'style/images/edit.png" alt="edit" />';
                        echo '</a>';
                        echo '</td>';
                        echo '<td>';
                        echo '<a href="javascript://" title="'.base_url().'mk/admin/municipalities/deletemunicipalities/'.$mun->pkMunicipalityID.'" class = "confirmDelete">';
                            echo '<img src="'.base_url().'style/images/cancel.png" alt="delete" />';
                        echo '</a>';
                        echo '</td>';

                     }
                    echo '</tr>';
                }
                ?>
            </tbody>
        </table>
    </div>
</div>
